package com.burnerpat.fl2d.core;

public class Clock
{
	private static long lastFrame = 0;
	private static long currFrame = 0;
	private static long frameTime = 0;
	private static long baseFPS = 60;
	private static long baseFrameTime = 1000 / baseFPS;
	
	private static double stepSize = 1.0;
	private static double currFPS = 60.0;
	
	public static void init()
	{
		currFrame = System.currentTimeMillis();
		lastFrame = currFrame - 100;
		frameTime = 100;
	}
	
	public static void update()
	{
		lastFrame = currFrame;
		currFrame = System.currentTimeMillis();
		frameTime = currFrame - lastFrame;
		currFPS = 1000.0 / (double)frameTime;
		stepSize = (double)frameTime / (double)baseFrameTime;
	}
	
	public static double getStepSize()
	{
		return stepSize;
	}
	
	public static long getBaseFPS()
	{
		return baseFPS;
	}
	
	public static void setBaseFPS(long pFPS)
	{
		baseFPS = pFPS;
		baseFrameTime = 1000 / baseFPS;
	}
	
	public static double getCurrentFPS()
	{
		return currFPS;
	}
	
	public static long getLastFrame()
	{
		return lastFrame;
	}
	
	public static long getCurrentFrame()
	{
		return currFrame;
	}
	
	public static long getFrameTime()
	{
		return frameTime;
	}
}
